﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LifeInSharePoint.Common
{
    public static class SPVerificationHelper
    {
        /// <summary>
        /// Verifies that the int argument is not zero
        /// </summary>
        /// <param name="argumentValue">
        /// The integer to validate
        /// </param>
        /// <param name="argumentName">
        /// Name of the argument.
        /// </param>
        public static void VerifyIntArgument(int argumentValue, string argumentName)
        {
            if (argumentValue == 0)
            {
                throw new ArgumentException(argumentName);
            }
        }

        /// <summary>
        /// Verifies the object argument.
        /// </summary>
        /// <param name="objectToValidate">
        /// The object to validate.
        /// </param>
        /// <param name="argumentName">
        /// Name of the argument.
        /// </param>
        public static void VerifyObjectArgument(object objectToValidate, string argumentName)
        {
            if (objectToValidate == null)
            {
                // Uses reflection, but hey, this is an exception.
                throw new ArgumentNullException(argumentName);
            }
        }

        /// <summary>
        /// Verifies the string argument.
        /// </summary>
        /// <param name="stringToValidate">
        /// The string to validate.
        /// </param>
        /// <param name="argumentName">
        /// Name of the argument.
        /// </param>
        public static void VerifyStringArgument(string stringToValidate, string argumentName)
        {
            if (string.IsNullOrEmpty(stringToValidate))
            {
                // Uses reflection, but hey, this is an exception.
                throw new ArgumentException(argumentName);
            }
        }
    }
}
